
local w = 200
local panel = class.panel:builder 
{
    x = (1920-w)/2,
    y = 0,
    w = w,
    h = 80,
    fdf = 'tooltip_backdrop1',
    --show_flag = false,
    title = {
        type = 'text',
        text = '等待选择难度',
        font_size = 12,
        align = 5,
        h = 40,
    },
    time = {
        type = 'text',
        text = '',
        y = 40,
        h = 40,
        font_size = 12,
        align = 5,
    },
    icon = {
        type = 'panel',
        x = (w-512)/2,
        y = 200,
        w = 512,
        h = 128,
        normal_image = [[]],
    }
}

ac.game:event '游戏-设置顶部计时'(function(_,title1,timer,title2)
    panel.title:set_text(title1)
    panel.title2 = title2
    panel.timer = timer
end)

ac.hardware:event '界面绘制'(function(_,frame)
    if panel.timer and not panel.timer.removed then
        panel.time:set_text(('%s%0.f'):format(panel.title2,panel.timer:get_remaining()/1000))
    end
end)

-- local time = 0
-- ac.loop(30,function()
--     time = time + 0.03
--     local min = math.floor(time/60)
--     local title = ('时间：%0.f分%0.f秒'):format(min,time%60)
--     panel.time:set_text(title)
-- end)